/************************************************************
* @file gkt_voice_lib.h
************************************************************/

#ifndef GKT_VOICE_LIB_H
#define GKT_VOICE_LIB_H

#include "gkt_types.h"

#ifdef __cplusplus
extern "C" {
#endif

#define GKT_VOICE_DEC_CONVERSION_SAMPLE_MULTIPLE 6 //4 - 32K; 6 - 48k;

/************************************************************
 * DEC sampling_point_bits
 ************************************************************/
#ifdef GKT_CONFIG_VOICE_DEC_SAMPLE_POINT_BITS
#define GKT_VOICE_DEC_SAMPLE_POINT_BITS	GKT_CONFIG_VOICE_DEC_FRAME_SP_BITS
#else
#define GKT_VOICE_DEC_SAMPLE_POINT_BITS	16
#endif

/************************************************************
 * DEC frame sample 
 ************************************************************/
#ifdef GKT_CONFIG_VOICE_DEC_FRAME_SAMPLE
#define GKT_VOICE_DEC_FRAME_SAMPLE	\
	GKT_CONFIG_VOICE_DEC_FRAME_SAMPLE
#else
#define GKT_VOICE_DEC_FRAME_SAMPLE	8000
#endif

/************************************************************
 * DEC frame duration (ms)
 ************************************************************/
#ifdef GKT_CONFIG_VOICE_DEC_FRAME_DURATION
#define GKT_VOICE_DEC_FRAME_DURATION	GKT_CONFIG_VOICE_DEC_FRAME_DURATION
#else
#define GKT_VOICE_DEC_FRAME_DURATION	20
#endif
#define GKT_VOICE_DEC_FRAMES_PER_SECOND	\
	(1000 / GKT_VOICE_DEC_FRAME_DURATION)


/************************************************************
 * DEC input_frame_size
 *  ZERO    : the input frame size is variable
 *  NONZERO : the input frame size is fixed
 ************************************************************/
#ifdef GKT_CONFIG_VOICE_DEC_INPUT_FRAME_SIZE
#define GKT_VOICE_DEC_INPUT_FRAME_SIZE	GKT_CONFIG_VOICE_DEC_INPUT_FRAME_SIZE
#else
#define GKT_VOICE_DEC_INPUT_FRAME_SIZE	0
#endif

/************************************************************
 * DEC output_frame size (sampling point nums)
 ************************************************************/
#define GKT_VOICE_DEC_OUTPUT_FRAME_SIZE	\
	(GKT_VOICE_DEC_FRAME_SAMPLE / GKT_VOICE_DEC_FRAMES_PER_SECOND)

typedef enum {
	GKT_FRAME_TYPE_HEAD = 0,
	GKT_FRAME_TYPE_MIDDLE,
	GKT_FRAME_TYPE_TAIL
}gkt_frame_type;

int gkt_voice_lib_init(void);

uint32_t gkt_voice_decode(uint32_t volume, uint32_t frame_nums,
			const void *enc_buff, void *dec_buff, gkt_frame_type isend);
void gkt_voice_decode_stop(void);

#ifdef __cplusplus
}
#endif

#endif	/* GKT_VOICE_H */

